﻿using System;
using System.Collections.Generic;
using System.Text;
using EnCor.Security;
using EnCor.Aspnet.Security;
using EnCor.ObjectBuilder;

namespace EnCor.Aspnet.Security
{
    [AssembleConfig(typeof(AspnetAuthenticationProviderConfig))]
    public class AspnetAuthenticationProvider : AuthenticationProvider
    {

        public override UserIdentity Authenticate(Credential credential)
        {
            AspnetCredential aspnetCredential = credential as AspnetCredential;
            if (aspnetCredential == null)
            {
                return null;
            }

            return new UserIdentity(aspnetCredential.Name, aspnetCredential.Name);
        }

        public override string CredentialType
        {
            get { return CredentialTypes.AspnetFormsCredential; }
        }
    }
}
